home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Networking / OTSimpleDownloadHTTP / OTSimpleDownloadHTTP.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  1.9 KB  |  53 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        OTSimpleDownloadHTTP.h
  3.  
  4.     Contains:    Interface to the simple HTTP download sample.
  5.  
  6.     Written by: Quinn "The Eskimo!"    
  7.  
  8.     Copyright:    Copyright © 1997-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/23/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23. #include <Types.h>
  24.  
  25. OSStatus DownloadHTTPSimple(const char *hostName,
  26.                             const char *httpCommand,
  27.                             const short destFileRefNum);
  28.  
  29. // Download a URL from the a web server.  hostName is a pointer
  30. // to a string that contains the DNS address of the web server.
  31. // The DNS address must be suffixed by ":<port>", where <port>
  32. // is the port number the web server is operating on.
  33. // httpCommand contains the HTTP command to send.  Typically this
  34. // is of the form:
  35. //
  36. //        GET <x> HTTP/1.0\0x13\0x10\0x13\0x10
  37. //
  38. // where <x> is the URL path.  destFileRefNum is the file
  39. // reference number to which the results of the HTTP command
  40. // are written.  This routine does not parse the returned HTTP
  41. // header in any way.  The entire incoming stream goes into
  42. // the file verbatim.
  43. //
  44. // For example, if you were asked to download a URL like:
  45. //
  46. //        http://devworld.apple.com/dev/technotes.shtml
  47. //
  48. // you would set:
  49. //
  50. //         o hostName to "devworld.apple.com:80" (80 is the
  51. //          default port for HTTP.
  52. //        o httpCommand to "GET /dev/technotes.shtml HTTP/1.0\0x13\0x10\0x13\0x10"
  53.